package com.java.base.exercise;

/**
 * @Author RenPu
 * @Date 2021/12/10 13:27
 * @Version 1.0
 * @Description:
 **/
public enum  OrderStatusEnum {
    XI_JUN(1,"细菌苗"),
    YI_ZHIFU(2,"菌苗"),
    YI_FAHUO(3,"待定"),
    QI_TA(4,"其它"),
    CHU_FANG(5,"处方类药品"),
    WEI_ZHI(6,"未知类型"),
    DEFAULT(-1,"未知类型");
    private int index;
    private String desc;
    public int getIndex() {
        return index;
    }
    public String getDesc() {
        return desc;
    }
    OrderStatusEnum(int index, String desc){
        this.index = index;
        this.desc =desc;
    }
    public static OrderStatusEnum of(int orderStatus) {
        if(orderStatus==0){
            return DEFAULT;
        }
        for (OrderStatusEnum temp : OrderStatusEnum.values()) {
            if (temp.getIndex() == orderStatus) {
                return temp;
            }
        }
        return null;
    }

}
